<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Appointment extends CI_Controller {
	public function index() {
            if($this->session->userdata('isLoggedIn')) {
                
                $this->load->view('crm/portal',$data);                 
            }
            else {
                redirect('login');
            }
           
	}
        
        public function showAddAppointmentForm(){
            echo json_encode($data);
        }
        
        public function  hideAddAppointmentForm(){
            echo json_encode($data);
        }

        public function addAppointment(){
            $appointmentSubject = $this->input->post('appointmentSubject');
            $appointmentLocation = $this->input->post('appointmentLocation');
            $appointmentDateTime = $this->input->post('appointmentDateTime');
            $appointmentStatus = $this->input->post('appointmentStatus');
            $appointmentDescription = $this->input->post('appointmentDescription');
            
            
            if(!$appointmentDescription || !$appointmentSubject){
                 $data['error'] = 'Please fill in all required fields.';
                echo json_encode($data);
            }
            else{
                echo json_encode($data);
            }
        }
        
}